import 'package:json_annotation/json_annotation.dart';

part 'cook_today_model.g.dart';

@JsonSerializable()
class CookTodayModel {
  final String? code;
  final bool? charge;
  final String? msg;
  final Result? result;
  final String? requestId;

  const CookTodayModel({
    this.code,
    this.charge,
    this.msg,
    this.result,
    this.requestId,
  });

  factory CookTodayModel.fromJson(Map<String, dynamic> json) =>
      _$CookTodayModelFromJson(json);

  Map<String, dynamic> toJson() => _$CookTodayModelToJson(this);
}

@JsonSerializable()
class Result {
  final int? total;
  final int? num;
  final List<CookList>? list;

  const Result({
    this.total,
    this.num,
    this.list,
  });

  factory Result.fromJson(Map<String, dynamic> json) =>
      _$ResultFromJson(json);

  Map<String, dynamic> toJson() => _$ResultToJson(this);
}

@JsonSerializable()
class CookList {
  final int? id;
  final int? classid;
  final String? name;
  final String? peoplenum;
  final String? preparetime;
  final String? cookingtime;
  final String? content;
  final String? pic;
  final String? tag;
  final List<Material>? material;
  final List<Process>? process;

  const CookList({
    this.id,
    this.classid,
    this.name,
    this.peoplenum,
    this.preparetime,
    this.cookingtime,
    this.content,
    this.pic,
    this.tag,
    this.material,
    this.process,
  });

  factory CookList.fromJson(Map<String, dynamic> json) =>
      _$CookListFromJson(json);

  Map<String, dynamic> toJson() => _$CookListToJson(this);
}

@JsonSerializable()
class Material {
  final String? mname;
  final int? type;
  final String? amount;

  const Material({
    this.mname,
    this.type,
    this.amount,
  });

  factory Material.fromJson(Map<String, dynamic> json) =>
      _$MaterialFromJson(json);

  Map<String, dynamic> toJson() => _$MaterialToJson(this);
}

@JsonSerializable()
class Process {
  final String? pcontent;
  final String? pic;

  const Process({
    this.pcontent,
    this.pic,
  });

  factory Process.fromJson(Map<String, dynamic> json) =>
      _$ProcessFromJson(json);

  Map<String, dynamic> toJson() => _$ProcessToJson(this);
}
